<?php
if(!class_exists('XApplicationEvent', false)){
	require_once(XFRAMEWORK_DIR.'/core/event/XApplicationEvent.php');
}
class XLoggingEvent extends XApplicationEvent{
	protected $level = null;
	protected $message = null;
	protected $exception = null;
	protected $timestamp = null;
	
	public function __construct($source, $level, $message, $exception = null){
		parent::__construct($source);
		$this->timestamp = time();
		$this->level = $level;
		$this->message = $message;
		$this->exception = $exception;
	}
	
	public function getLevel(){
		return $this->level;
	}
	
	public function getLevelInString(){
		switch($this->level){
			case DEBUG:
				return 'DEBUG';
			case INFO:
				return 'INFO';
			case WARN:
				return 'WARN';
			case ERROR:
				return 'ERROR';
			default:
				return 'DEBUG';				
		}
	}
	
	public function getMessage(){
		return $this->message;
	}
	
	/**
	 * @return Exception
	 */		
	public function getException(){
		return $this->exception;
	}	
	
	public function getTimestamp(){
		return $this->timestamp;
	}
}
?>